package GUI;

import java.util.ArrayList;

import Control.Character;
import processing.core.PImage;


class CharacterInfoPanelButton extends Component
{
	public boolean selected =false;
	public CloseButton closeButton;
	public Character c;

	////////////////////////////////////////////////////////////////////////////////////////////////////
	public CharacterInfoPanelButton(Character ci)
	{
		width =  165;
		height = 25;
		c=ci;
		label = c.getShortName();
		closeButton = new CloseButton(c);

	}
	public void draw()
	{
		Utils.globalProcessing.textFont(Utils.plotFont, 19);
		width = (int)(Utils.globalProcessing.textWidth(label)) + 10;
		//TODO suggerimenti per nomi troppo lunghi copiare dalle catch phrases
		int cx = x;
		int cy = y;
		if(label != null)
		{
			Utils.globalProcessing.textAlign(Utils.globalProcessing.LEFT);

			if(mouseOver()) 
			{
				
				
					Utils.characterInfoPanelHighLight = this;
				

			}else if(Utils.characterInfoPanelHighLight == this)
				Utils.characterInfoPanelHighLight = null;

			Utils.globalProcessing.strokeWeight(1);
			Utils.globalProcessing.fill(255);

				if(selected)
					Utils.globalProcessing.textFont(Utils.plotBoldFont, 15);
				else
					Utils.globalProcessing.textFont(Utils.plotFont, 15);
				Utils.globalProcessing.text(label, cx + 5, cy + 15);

			

		}
	}
	
	public void drawInfoBox(int x,int y,int width, String label){
	    Utils.globalProcessing.fill(200);
	    Utils.globalProcessing.stroke(80);
	    Utils.globalProcessing.strokeWeight(1);
	    Utils.globalProcessing.rect(x, y, width, 30);

	    Utils.globalProcessing.fill(0);
	    //Utils.globalProcessing.textFont(Utils.globalProcessing.plotFont, 14);
	    Utils.globalProcessing.textAlign(Utils.globalProcessing.LEFT);
	    Utils.globalProcessing.text(label, x + 5, y + 20);
	}
	

	////////////////////////////////////////////////////////////////////////////////////////////////////
	PImage icon;
	String label;
}